package com.qingke.hibernate.bean;

import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name="accommodation")
//@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Accommodation {
	@Id
	@Column(name="id")
	private int id;
	
	@Column(name="create_datetime")
	private Date createTime;
	
	@Column(name="expire_datetime")
	private Date expireTime;
	
	@OneToOne
	@JoinColumn(name="apartment_id")
	private Apartment apartment;
	
	@OneToOne(mappedBy="accommodation")
	private Student student;
//	@Column(name="apartment_id")
//	private int apartmentId;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Date getExpireTime() {
		return expireTime;
	}
	public void setExpireTime(Date expireTime) {
		this.expireTime = expireTime;
	}
	public Apartment getApartment() {
		return apartment;
	}
	public void setApartment(Apartment apartment) {
		this.apartment = apartment;
	}
	public Student getStudent() {
		return student;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	@Override
	public String toString() {
		return "Accommodation [id=" + id + ", createTime=" + createTime + ", expireTime=" + expireTime + ", apartment="
				+ apartment + "]";
	}
	
	
}
